package com.example.jz.noone.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;

import com.example.jz.noone.R;
import com.example.jz.noone.utils.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class IssueTextActivity extends BaseActivity {
    @BindView(R.id.spinner)
    Spinner spinner;
    final String[] arr={"栏目一","栏目二","栏目三","栏目四","栏目一","栏目二","栏目三","栏目四"};
    @BindView(R.id.left)
    ImageView left;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.issue_text );
        ButterKnife.bind( this );
        //创建ArrayAdapter对象
        ArrayAdapter <String> adapter=new ArrayAdapter <String>( this,android.R.layout.simple_dropdown_item_1line,arr );
        spinner.setAdapter( adapter );
        /**选项选择监听*/
        spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView <?> parent,View view,int position,long id) {
                Toast.makeText( IssueTextActivity.this,"点击了" + arr[position],Toast.LENGTH_SHORT ).show();
            }

            @Override
            public void onNothingSelected(AdapterView <?> parent) {

            }
        } );

    }

    @OnClick(R.id.left)
    public void onClick() {
        finish();
    }
}
